if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_GetUserByRole]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[sp_GetUserByRole]
GO
CREATE PROC sp_GetUserByRole
	@role	int
AS
BEGIN
	SELECT A.ID, A.Username, A.Password, A.Salt, B.Name As AccountType,
		 C.FirstName, C.LastName, C.Email, C.Address, C.Phone,
		 cast(datepart(mm,C.Birthday) as varchar) As BMonth,
		 cast(datepart(dd,C.Birthday) as varchar) As BDay,
		 cast(datepart(yyyy,C.Birthday) as varchar) As BYear
		FROM Account As A INNER JOIN AccountType As B ON A.AccountType = B.ID
			INNER JOIN AccountInformation As C On A.ID = C.AccountID
			WHERE A.AccountType = @role
END